package com.gientech.test;

import com.gientech.spring.factory.CofferFactory;
import com.gientech.spring.model.Coffee;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringBeanForXML {
    @Test
    public void Test() throws Exception {
        //ApplicationContext:表示ioc容器
        //ClassPathXmlApplicationContext:表示从当前classpath路径中获取xml文件的配置
        //根据spring的配置文件来获取ioc容器对象
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:spring-beans.xml");
        Coffee coffee = ctx.getBean(Coffee.class);
        System.out.println("XML Loader Coffee bean = " + coffee);
    }
}
